import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:hive_flutter/hive_flutter.dart';
import 'package:ichinesereader/themes/appTheme.dart';

class AppButtonStyles {
  final box = Hive.box('appconfig');

  ButtonStyle loginButtonStyle() {
    return ButtonStyle(
      elevation: MaterialStateProperty.all<double>(0),
      shape: MaterialStateProperty.all<RoundedRectangleBorder>(
          RoundedRectangleBorder(
        borderRadius: BorderRadius.circular(3.0),
        //side: BorderSide(color: Colors.red)
      )),
      minimumSize: MaterialStateProperty.all(
        Size(double.infinity, 63),
      ),
      foregroundColor: MaterialStateProperty.all(
        Colors.white,
      ),
      backgroundColor: MaterialStateProperty.all(
        Get.isDarkMode ? AppTheme.colors.primary : Get.theme.primaryColorDark,
      ),
      textStyle: MaterialStateProperty.all<TextStyle?>(TextStyle(
        letterSpacing: 1,
        fontSize: 21.0,
      )),
    );
  }

  ButtonStyle badgeButtonStyle() {
    return ButtonStyle(
      elevation: MaterialStateProperty.all<double>(0),
      shape: MaterialStateProperty.all<RoundedRectangleBorder>(
        RoundedRectangleBorder(
          borderRadius: BorderRadius.circular(24.0),
          side: BorderSide(
              width: 1.8,
              color: Get.isDarkMode
                  ? AppTheme.colors.secondaryColor
                  : Get.theme.secondaryHeaderColor),
        ),
      ),
      minimumSize: MaterialStateProperty.all(
        Size(double.infinity, 66),
      ),
      foregroundColor: MaterialStateProperty.all(
        Get.isDarkMode
            ? AppTheme.colors.secondaryColor
            : Get.theme.secondaryHeaderColor,
      ),
      backgroundColor: MaterialStateProperty.all(
        Colors.white,
      ),
      textStyle: MaterialStateProperty.all<TextStyle?>(TextStyle(
        letterSpacing: 1,
        fontSize: 21.0,
      )),
    );
  }

  ButtonStyle cleverButtonStyle() {
    return ButtonStyle(
      elevation: MaterialStateProperty.all<double>(0),
      shape: MaterialStateProperty.all<RoundedRectangleBorder>(
        RoundedRectangleBorder(
          borderRadius: BorderRadius.circular(24.0),
          side: BorderSide(
              width: 1.8,
              color: Get.isDarkMode
                  ? AppTheme.colors.primary
                  : Get.theme.primaryColor),
        ),
      ),
      minimumSize: MaterialStateProperty.all(
        Size(double.infinity, 66),
      ),
      foregroundColor: MaterialStateProperty.all(
        Get.theme.primaryColor,
      ),
      backgroundColor: MaterialStateProperty.all(
        Colors.white,
      ),
      textStyle: MaterialStateProperty.all<TextStyle?>(TextStyle(
        letterSpacing: 1,
        fontSize: 21.0,
      )),
    );
  }

  ButtonStyle parentButtonStyle() {
    return ButtonStyle(
      elevation: MaterialStateProperty.all<double>(0),
      shape: MaterialStateProperty.all<RoundedRectangleBorder>(
          RoundedRectangleBorder(
              borderRadius: BorderRadius.circular(24.0),
              side: BorderSide(
                  width: 1.8,
                  color: Get.isDarkMode
                      ? AppTheme.colors.primaryDark
                      : Get.theme.primaryColorDark))),
      minimumSize: MaterialStateProperty.all(
        Size(double.infinity, 66),
      ),
      foregroundColor: MaterialStateProperty.all(
        Get.theme.primaryColorDark,
      ),
      backgroundColor: MaterialStateProperty.all(
        Colors.white,
      ),
      textStyle: MaterialStateProperty.all<TextStyle?>(TextStyle(
        letterSpacing: 1,
        fontSize: 21.0,
      )),
    );
  }

  ButtonStyle profileButtonStyle() {
    // bool isDarkMode = box.get('theme', defaultValue: 0) == 1;
    return ButtonStyle(
      textStyle: MaterialStateProperty.all<TextStyle?>(
        TextStyle(
          color: Get.isDarkMode ? Colors.black : Get.theme.primaryColorLight,
          fontSize: 18,
          fontFamily: 'Montserrat',
        ),
      ), // 这里的textstyle也可以使用app theme里定义text style
      backgroundColor: Get.isDarkMode
          ? MaterialStateProperty.all<Color?>(Get.theme.primaryColorDark)
          : MaterialStateProperty.all<Color?>(Get.theme.primaryColor),
    );
  }

  ButtonStyle createButtonStyle() {
    //bool isDarkMode = box.get('theme', defaultValue: 0) == 1;
    return ButtonStyle(
      enableFeedback: true,
      textStyle: MaterialStateProperty.all<TextStyle?>(
        TextStyle(
          fontFamily: 'Montserrat',
          color: Get.isDarkMode ? Colors.black : Get.theme.primaryColorLight,
          fontSize: 15,
        ),
      ),
      backgroundColor:
          MaterialStateProperty.all<Color>(Get.theme.primaryColorDark),
    );
  }

  ButtonStyle addButtonStyle() {
    //bool isDarkMode = box.get('theme', defaultValue: 0) == 1;
    return ButtonStyle(
      textStyle: MaterialStateProperty.all<TextStyle?>(TextStyle(
        color: Get.isDarkMode ? Colors.black : AppTheme.colors.primaryLight,
        fontSize: 15,
        fontFamily: 'Montserrat',
      )),
      backgroundColor: MaterialStateProperty.all<Color?>(
          Get.isDarkMode ? Get.theme.primaryColorDark : AppTheme.colors.addBtn),
    );
  }

  ButtonStyle moveButtonStyle() {
    //bool isDarkMode = box.get('theme', defaultValue: 0) == 1;
    return ButtonStyle(
      textStyle: MaterialStateProperty.all<TextStyle?>(
        TextStyle(
          color: Get.isDarkMode ? Colors.black : Get.theme.primaryColorLight,
          fontSize: 15,
          fontFamily: 'Montserrat',
        ),
      ),
      backgroundColor:
          MaterialStateProperty.all<Color?>(Get.theme.primaryColorDark),
    );
  }

  ButtonStyle removeButtonStyle() {
    //bool isDarkMode = box.get('theme', defaultValue: 0) == 1;
    return ButtonStyle(
      textStyle: MaterialStateProperty.all<TextStyle?>(TextStyle(
        color: Get.isDarkMode ? Colors.black : AppTheme.colors.lightPink,
        fontSize: 15,
        fontFamily: 'Montserrat',
      )),
      backgroundColor: MaterialStateProperty.all<Color?>(Get.isDarkMode
          ? Get.theme.primaryColorDark
          : AppTheme.colors.deleteBtn),
    );
  }

  ButtonStyle deleteButtonStyle() {
    //bool isDarkMode = box.get('theme', defaultValue: 0) == 1;
    return ButtonStyle(
      textStyle: MaterialStateProperty.all<TextStyle?>(TextStyle(
        color: Get.isDarkMode ? Colors.black : AppTheme.colors.lightPink,
        fontSize: 15,
        fontFamily: 'Montserrat',
      )),
      backgroundColor: MaterialStateProperty.all<Color?>(Get.isDarkMode
          ? Get.theme.primaryColorDark
          : AppTheme.colors.deleteBtn),
    );
  }

  ButtonStyle exportButtonStyle() {
    // bool isDarkMode = box.get('theme', defaultValue: 0) == 1;
    return ButtonStyle(
      textStyle: MaterialStateProperty.all<TextStyle?>(
        TextStyle(
          color: Get.isDarkMode ? Colors.black : Get.theme.primaryColorLight,
          fontSize: 15,
          fontFamily: 'Montserrat',
        ),
      ), // 这里的textstyle也可以使用app theme里定义text style
      backgroundColor:
          MaterialStateProperty.all<Color?>(Get.theme.primaryColorDark),
    );
  }

  ButtonStyle printLetterButtonStyle() {
    //bool isDarkMode = box.get('theme', defaultValue: 0) == 1;
    return ButtonStyle(
      textStyle: MaterialStateProperty.all<TextStyle?>(
        TextStyle(
          color: Get.isDarkMode ? Colors.black : Get.theme.primaryColorLight,
          fontSize: 15,
          fontFamily: 'Montserrat',
        ),
      ), // 这里的textstyle也可以使用app theme里定义text style

      backgroundColor:
          MaterialStateProperty.all<Color?>(Get.theme.primaryColorDark),
    );
  }

  ButtonStyle printCardButtonStyle() {
    //bool isDarkMode = box.get('theme', defaultValue: 0) == 1;
    return ButtonStyle(
      textStyle: MaterialStateProperty.all<TextStyle?>(
        TextStyle(
          color: Get.isDarkMode ? Colors.black : Get.theme.primaryColorLight,
          fontSize: 15,
          fontFamily: 'Montserrat',
        ),
      ), // 这里的textstyle也可以使用app theme里定义text style

      backgroundColor:
          MaterialStateProperty.all<Color?>(Get.theme.primaryColorDark),
    );
  }

  ButtonStyle enableButtonStyle() {
    //bool isDarkMode = box.get('theme', defaultValue: 0) == 1;
    return ButtonStyle(
      textStyle: MaterialStateProperty.all<TextStyle?>(
        TextStyle(
          color: Get.isDarkMode ? Colors.black : Get.theme.primaryColorLight,
          fontSize: 15,
          fontFamily: 'Montserrat',
        ),
      ), // 这里的textstyle也可以使用app theme里定义text style

      backgroundColor:
          MaterialStateProperty.all<Color?>(Get.theme.primaryColorDark),
    );
  }

  ButtonStyle disableButtonStyle() {
    //bool isDarkMode = box.get('theme', defaultValue: 0) == 1;
    return ButtonStyle(
      textStyle: MaterialStateProperty.all<TextStyle?>(TextStyle(
        color: Get.isDarkMode ? Colors.black : Get.theme.primaryColorLight,
        fontSize: 15,
        fontFamily: 'Montserrat',
      )), // 这里的textstyle也可以使用app theme里定义text style

      backgroundColor:
          MaterialStateProperty.all<Color?>(Get.theme.primaryColorDark),
    );
  }

  ButtonStyle duplicateButtonStyle() {
    //bool isDarkMode = box.get('theme', defaultValue: 0) == 1;
    return ButtonStyle(
      textStyle: MaterialStateProperty.all<TextStyle?>(
        TextStyle(
          color: Get.isDarkMode ? Colors.black : Get.theme.primaryColorLight,
          fontSize: 15,
          fontFamily: 'Montserrat',
        ),
      ), // 这里的textstyle也可以使用app theme里定义text style

      backgroundColor:
          MaterialStateProperty.all<Color?>(Get.theme.primaryColorDark),
    );
  }
}
